package com.botarena.client;

import com.botarena.shared.UserInfo;
import com.google.gwt.user.client.ui.Anchor;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Panel;

/**
 * Menu contents
 * 
 * @author Aleksandra Lipiec
 * 
 */
public class MenuViewer {
	
	public static Panel createMainMenuPanel(final UserInfo info) {
		HorizontalPanel panel = new HorizontalPanel();

		Anchor ranking = new Anchor("Ranking", SiteTokens
				.hashToken(SiteTokens.RANKING));
		ranking.setStyleName("menuLink");
		
		Anchor home = new Anchor("Bot arena", SiteTokens
				.hashToken(SiteTokens.HOME));
		home.setStyleName("menuLink");

		Anchor about = new Anchor("About", SiteTokens
				.hashToken(SiteTokens.ABOUT));
		about.setStyleName("menuLink");
		
		Anchor battles = new Anchor("Battles", SiteTokens
				.hashToken(SiteTokens.BATTLES));
		battles.setStyleName("menuLink");
		
		Anchor myBots = new Anchor("My bots", SiteTokens
				.hashToken(SiteTokens.MY_BOTS));
		myBots.setStyleName("menuLink");
		
		Anchor admin = new Anchor("Admin", SiteTokens
				.hashToken(SiteTokens.ADMIN));
		admin.setStyleName("menuLink");
		
		//panel.add(home);
		panel.add(ranking);
		panel.add(battles);
		
		if (info.hasAccount()) {
			panel.add(myBots);
			if(info.isAdmin()){
				panel.add(admin);
			}
		}
		panel.add(about);

		return panel;

	}

	public static RightMenu createRightMenuPanel(UserInfo info) {
		return new RightMenu(info);
	}

	

}
